package com.zx.sercurity;

import android.content.Context;
import android.provider.Settings;

public class DebugModeRisk implements RiskControlInterface<RiskResult.DebugModeRiskResult> {
    @Override
    public RiskResult.DebugModeRiskResult riskCheck(Context context) {
        return isDebugModeEnabled(context)? new RiskResult.DebugModeRiskResult(true) : new RiskResult.DebugModeRiskResult(false);
    }

    /**
     * 校验是否开启调试模式
     * @param context
     * @return
     */
    public boolean isDebugModeEnabled(Context context) {
        return Settings.Global.getInt(context.getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) == 1;
    }
}
